#ifndef __OTA_HTTP_H__
#define __OTA_HTTP_H__

#include <openssl/md5.h>

#define FILEINFO_URL "http://192.168.23.10:8000/fileinfo"
#define FW_URL_PREFIX "http://192.168.23.10:8000/download/"

typedef struct
{
    char *filename;
    char md5_hash[2 * MD5_DIGEST_LENGTH + 1];
    int major;
    int minor;
    int patch;
} Fileinfo;

/**
 * @brief 获取Fileinfo
 *
 * @return Fileinfo*
 */
int ota_http_getFileinfo(Fileinfo *fileinfo);

/**
 * @brief 下载并校验固件
 *
 * @param fileinfo
 * @return int 0 下载成功，-1 下载失败
 */
int ota_http_getFirmware(Fileinfo *fileinfo, char *filepath);

#endif /* __OTA_HTTP_H__ */